<template>
  <div class="box-book">
    <div class="book-info-box">
      <img class="book-image" :src="`${ props.item ? props.item.imgUrl : '../src/assets/images/t6_24965201.jpg' }`" alt=""/>
      <div class="book-info">
        <div class="book-name">
          <span>{{ props.item ? props.item.name : "平凡的世界" }}</span>
        </div>
        <div class="book-author">
          {{ props.item ? props.item.author : "艾林" }}
        </div>
        <div class="book-rating">
          读书推荐
        </div>
        <div class="book-rating-box">
          <div class="book-rating-info">
            <div class="chart">
              {{ props.item ? props.item.number1 : "75%" }}
            </div>
            <div class="rating-label">
              推荐
            </div>
          </div>

          <div class="book-rating-info">
            <div class="chart">
              {{ props.item ? props.item.number2 : "20%" }}
            </div>
            <div class="rating-label">
              一般
            </div>
          </div>
          <div class="book-rating-info">
            <div class="chart">
              {{ props.item ? props.item.number3 : "5%" }}
            </div>
            <div class="rating-label">
              不推荐
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="book-describe">
      &nbsp; &nbsp; &nbsp; &nbsp;
      {{ props.item ? props.item.describe : " 1975年初农民子弟孙少平到原西县高中读书，他贫困，自卑；后对处境相同的地主家庭出身的郝红梅产生情愫，在被同班同学侯玉英发现并当众说破后，" }}
    </div>
  </div>
</template>

<script lang="ts" setup>
const props = defineProps({
  item: {
    required: true
  }
})
</script>

<style lang="less" scoped>

.box-book {
  //width: 300px;
  //height: 180px;
  border-radius: 15px;
  display: flex;
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  background-image: linear-gradient(to right, #b8cbb8 0%, #b8cbb8 0%, #b465da 0%, #cf6cc9 33%, #ee609c 66%, #ee609c 100%);

  .book-describe {
    font-size: 10px;
    width: 100%;
    height: 50px;
    display: -webkit-box; //将对象作为弹性伸缩盒子模型显示
    -webkit-box-orient: vertical; //设置或检索伸缩盒对象的子元素的排列方式
    -webkit-line-clamp: 3;
    overflow: hidden;
    text-overflow: ellipsis;


  }

  .book-info-box {
    display: flex;
    font-size: 12px;

    .book-info {
      margin-left: 10px;
      font-size: 12px;

      .book-author, .book-rating {
        font-size: 10px;
      }

      .book-rating-box {
        width: 150px;
        display: flex;
        justify-content: space-between;
        align-items: center;

        .book-rating-info {
          width: 40px;
          height: 50px;
          display: flex;
          flex-direction: column;
          align-items: center;
          justify-content: space-between;

          .chart {
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 3px solid #4576ff;
            border-radius: 50%;
            background-color: #524e9f;
            color: white;
          }

          .rating-label {
            font-size: 10px;
            color: white;
          }
        }
      }
    }

    .book-image {
      width: 80px;
      height: 110px;
      background-image: url("@/assets/images/t6_24965201.jpg");
      background-size: 80px 110px;
    }

  }


}
</style>